Skip to content

Conversation

dkhalanskyjb
Copy link
Collaborator

Additionally, removed the outdated opt-ins into experimental standard library APIs, as those are all stable now.

Fixes #4333

Additionally, removed the outdated opt-ins into experimental
standard library APIs, as those are all stable now.

Fixes #4333
@murfel
Copy link
Contributor

murfel commented Sep 11, 2025

Just to clarify, you will also make a twin PR into stdlib to deprecate AbstractCoroutineContextKey, once you figure out the process for it?

@dkhalanskyjb
Copy link
Collaborator Author

@murfel, yes, but these are independent tasks.

AbstractCoroutineContextElement(ContinuationInterceptor), ContinuationInterceptor {

/** @suppress */
@Deprecated("Use ContinuationInterceptor.Key and attempt " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bit of a nuisance.

I would consider coupling this change with introduction of .dispatcher and .dispatcherOrNull extensions on CoroutineContext (not sure about the CoroutineScope).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, but this pattern is very niche anyway: https://grep.app/search?f.lang=Kotlin&regexp=true&q=%5B%5E+%5D%5C%5BCoroutineDispatcher%5C%5D

In addition, in most cases, using ContinuationInterceptor instead of CoroutineDispatcher doesn't make any functional difference (or even makes the code a bit more flexible), which means directing the few existing cases to .dispatcher is not ideal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've figured, but still see it as a good idea:

  • That's, generally, an informal respect to backwards compatibility and migration paths (i.e. not how we did it with capitalize) for users who do use that
  • The cost of this addition is negligible
  • In the spirit of the standard library, it is a small but really convenient addition when you need it. I believe even I was in need of that quite a few times (I was also pretty sure I created an issue for that, but I failed to find it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants